#lang racket

(define (f-rec n)
  (if (or (< n 3) (= n 3))
      n
      (+ (f-rec (- n 1)) (f-rec (- n 2)) (f-rec (- n 3)))))

(define (f-iter n)
  (if (or (< n 3) (= n 3))
      n
      (iter 3 2 1 3 n)))

(define (iter first second third first-level n)
  (if (= first-level n)
      first
      (iter (+ first second third) first second (+ first-level 1) n)))

(f-rec 10)

(f-iter 10)

